<!DOCTYPE html>
<!--[if IE 8]> <html lang="en" class="ie8 no-js"> <![endif]-->
<!--[if IE 9]> <html lang="en" class="ie9 no-js"> <![endif]-->
<!--[if !IE]><!-->
<html lang="en" class="no-js">
<!--<![endif]-->

<head>
<meta charset="utf-8">
<title>SMM撮合系统</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta content="width=device-width, initial-scale=1" name="viewport">
<meta content="" name="description">
<meta content="" name="author">
<script>BASE_URL ='${request.getContextPath()}'</script>
<link href="${request.getContextPath()}/Public/assets/admin/css/css.css" rel="stylesheet" type="text/css">
<link href="${request.getContextPath()}/Public/assets/global/plugins/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css">
<link href="${request.getContextPath()}/Public/assets/global/plugins/simple-line-icons/simple-line-icons.min.css" rel="stylesheet" type="text/css">
<link href="${request.getContextPath()}/Public/assets/global/plugins/bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css">
<link href="${request.getContextPath()}/Public/assets/global/plugins/uniform/css/uniform.default.css" rel="stylesheet" type="text/css">

<link href="${request.getContextPath()}/Public/assets/global/css/components-rounded.css" id="style_components" rel="stylesheet" type="text/css">
<link href="${request.getContextPath()}/Public/assets/global/css/plugins.css" rel="stylesheet" type="text/css">
<link href="${request.getContextPath()}/Public/assets/admin/css/layout.css" rel="stylesheet" type="text/css">
<link href="${request.getContextPath()}/Public/assets/admin/css/themes/default.css" rel="stylesheet" type="text/css" id="style_color">
<link href="${request.getContextPath()}/Public/assets/admin/css/custom.css" rel="stylesheet" type="text/css">
<link href="${request.getContextPath()}/Public/assets/global/plugins/bootstrap-datepicker/css/bootstrap-datepicker.min.css" rel="stylesheet" type="text/css">

<link href="${request.getContextPath()}/Public/assets/admin/css/common.css" rel="stylesheet" type="text/css">
<link href="${request.getContextPath()}/Public/assets/global/css/kkpager.css" rel="stylesheet" type="text/css">
<link rel="shortcut icon" href="${request.getContextPath()}/Public/favicon.ico">
<link href="${request.getContextPath()}/Public/css/client.css" rel="stylesheet" type="text/css">
<link href="${request.getContextPath()}/Public/css/customerDetail.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="${request.getContextPath()}/Public/My97DatePicker/WdatePicker.js"></script>
<style type="text/css">
body {
	margin: 0;
	padding: 0;
}
/*div_Import */
#div_Import {
	position: fixed;
	z-index: 999;
	width: 600px;
	height: 400px;
	border: 1px solid #ccc;
	background: #efefef;
	display: none;
	overflow: auto;
}

#div_Import .tit {
	background: #ddd;
	display: block;
	height: 15px;
}

#div_Import .tit i {
	float: right;
	line-height: 15px;
	padding: 0 8px;
	cursor: pointer;
}
</style>
</head>

<body class="page-header-top-fixed">
	<div id="div_Import">
		<div class="tit">
			<i class="close">关闭</i>
		</div>
		<!-- <form id="form_Import" enctype="multipart/form-data"> -->
		<p style="margin-left:50PX;">请选择导入的excel文件：</p>
		<input style="margin-left:90PX;" type="file" id="fileExcelData"
			name="fileExcelData" /> <input style="margin-left:80%;"
			type="button" class="btn green" value="上传" onclick="submitExcel();" />
		<p id="errorInfo" style="width:80%;margin-left:50PX;"></p>
		<!-- </form> -->
	</div>
	<!--头部信息结束 -->
	<div class="page-header">
		<!--头部开始-->
		<#include "/include/top.html" />
		<!-- 头部信息结束 -->


		<!-- 头部菜单开始 -->
		<#include "/include/top_menu.html" />
		<!-- 头部菜单结束 -->
	</div>
	<!-- END HEADER -->

	


		<!-- BEGIN PAGE CONTAINER -->
<div class="page-container">
	<!-- 内容开始 -->
	<div class="page-content">
		<div class="container-fluid">
			<!-- 当前位置提示结束 -->
			<div class="row margin-top-10">
				<div class="col-md-12">
					<div class="portlet light bordered">
						<div class="portlet-body" style="height: 13px;padding-top: 2px">
							<div style="float: left;">
									视图：
									<a href="${request.getContextPath()}/contacter/contacterList.do" id="allClient">全部</a> |
									<a href="${request.getContextPath()}/contacter/contacterList.do?but=0" id="myClient">网站注册</a> |
									<a href="${request.getContextPath()}/contacter/contacterList.do?but=6" id="deptClient">我的创建</a>|
									<a href="${request.getContextPath()}/contacter/contacterList.do?but=7" id="deptClient">部门创建的</a>
								</div>
								<div style="float: right;">
									<i class="fa fa-clock-o"></i> 
									<a href="${request.getContextPath()}/contacter/contacterList.do?but=1" id="createToday">今日新建</a> |
									<a href="${request.getContextPath()}/contacter/contacterList.do?but=2" id="createWeek">最近7天</a> |
									<a href="${request.getContextPath()}/contacter/contacterList.do?but=3" id="createMonth">本月新建</a> |
									<a href="${request.getContextPath()}/contacter/contacterList.do?but=4" id="recentModify">最近修改</a>
									&nbsp; &nbsp;<i class="fa fa-trash-o"></i> 
									<a href="${request.getContextPath()}/contacter/contacterList.do?but=5" id="recycle">回收站</a>
								</div>
							</div>
					</div>    
				</div>
				<!--位置提示结束  -->
				<div class="col-md-12">
				     <div class="portlet light bordered">
					    <div class="portlet-body">
						 <form id="frm1" method="post">
					    	<div class="row">
						    	  

							  <div style="float: left;width: 80%">
							  
							  <div style="float: left;width:110px; margin-left:15px;">
										<div class="btn-group pull-left">
											<button class="btn green dropdown-toggle" data-toggle="dropdown" aria-expanded="true">批量操作<i class="fa fa-angle-down"></i>
											</button>
											<ul class="dropdown-menu">
												<li>
													<a href="javascript:CommonUtils.doExecute('${request.getContextPath()}/contacter/contacterRemove.do');">批量删除 </a>
												</li>
												<li>
												
												 <a  onclick="editSMM()">发送短信 </a> 
								
												</li>
												
												<li>
													<a href="javascript:;" onclick="editMail()">发送邮件 </a>
												</li>
											</ul>
										</div>
								  </div>
							  
							   <div style="width:120px; float:left; margin-left:15px;">
								<select class="form-control" name="attribute" id="attribute" onblur="selectColumn();">
								  <option value="a.name" <#if qc??&&qc.attribute??&&qc.attribute=="a.name">selected="selected" </#if> >联系人</option>
								  <option value="a.mobilePhone" <#if qc??&&qc.attribute??&&qc.attribute=="a.mobilePhone">selected="selected" </#if> >手机</option>
								  <option value="a.qq" <#if qc??&&qc.attribute??&&qc.attribute=="a.qq">selected="selected" </#if>>QQ</option>
								  <option value="a.position" <#if qc??&&qc.attribute??&&qc.attribute=="a.position">selected="selected" </#if>>职位</option>
						 		  <option value="d.name" <#if qc??&&qc.attribute??&&qc.attribute=="d.name">selected="selected" </#if>>公司</option>
								  <option value="b.name" <#if qc??&&qc.attribute??&&qc.attribute=="b.name">selected="selected" </#if>>行业</option>
								  <option value="c.name" <#if qc??&&qc.attribute??&&qc.attribute=="c.name">selected="selected" </#if>>创建人</option> 
								  <option value="a.createdAt" <#if qc??&&qc.attribute??&&qc.attribute=="a.createdAt">selected="selected" </#if>>加入时间</option>
								</select>
							</div>
							<div  style="width:140px;float:left; margin-left:15px;">
								<select class="form-control" name="operator">
									  <option value="1" <#if qc??&&qc.operator??&&qc.operator=="1">selected="selected" </#if>>包含</option>
							          <option value="2" <#if qc??&&qc.operator??&&qc.operator=="2">selected="selected" </#if>>不包含</option>
							          <option value="3" <#if qc??&&qc.operator??&&qc.operator=="3">selected="selected" </#if>>等于</option>
							          <option value="4" <#if qc??&&qc.operator??&&qc.operator=="4">selected="selected" </#if>>不等于</option>
							          <option value="5" <#if qc??&&qc.operator??&&qc.operator=="5">selected="selected" </#if>>开始字符</option>
							          <option value="6" <#if qc??&&qc.operator??&&qc.operator=="6">selected="selected" </#if>>结束字符</option>
							          <option value="7" <#if qc??&&qc.operator??&&qc.operator=="7">selected="selected" </#if>>为空</option>
							          <option value="8" <#if qc??&&qc.operator??&&qc.operator=="8">selected="selected" </#if>>不为空</option>
								</select>
							</div>
							<div class="col-md-3">
								<input type="text" class="form-control" name="content" id="content" value="<#if qc??&&qc.content??>${qc.content}</#if>">
							</div>
							<div class="col-md-2">
									<button  class="btn green">
										<i class="fa fa-search"></i> 搜索 
									</button>
								</div>
							</div>
							
							
							<div style="float: right;width: 13%">
													<a  class="btn green" href="${request.getContextPath()}/contacter/contacterModify.do">
														<i class="fa fa-plus"></i> 新建联系人
													</a>
								</div>
						</div>
					</form>
						
						<div class="table-scrollable">
				          		<table class="table table-striped table-bordered table-advance table-hover ttTbl" id="myTable" >
						          	<thead>
										<tr>
											<th class="table-checkbox">
												<input type="checkbox" class="group-checkable" data-set="#myTable .checkboxes"/>
											</th>
											<th>联系人</th>
											<th>手机</th>
											<th>QQ</th>
											<th>职位</th>
											<th>公司</th>
											<th>行业</th>
											<th>创建人</th>
											<th>加入时间</th>
											<th>操作</th>
										</tr>
								</thead>
								<tbody>
										<#list list as contacter>
									       <tr class="odd gradeX">
												<td><input name="checkboxes" class="checkboxes" type="checkbox" data_phone="${(contacter.mobilePhone)!}" value="${contacter.id?if_exists}"></td>
												<td>${(contacter.name)!}</td>
												<td>${contacter.mobilePhone?if_exists}</td>
												<td>${contacter.qq?if_exists}</td>
												<td>${contacter.position?if_exists}</td>
												<td>${contacter.companyName?if_exists}</td>
												<td>${contacter.itemId?if_exists}</td>
												<td>${contacter.createdBy?if_exists}</td>
												<td>${contacter.createdAt?if_exists}</td> 
												<td style="text-align: center;">
													<a class="btn btn-xs green"  href="${request.getContextPath()}/contacter/contacterLook.do?id=${contacter.id}">查看</a> 
														<#if contacter.status==0>
															<a class="btn btn-xs green"  href="${request.getContextPath()}/contacter/contacterModify.do?id=${contacter.id}">修改</a>
														</#if>
												 </td>
											</tr>
									</#list>
								  </tbody>
								</table>
						 	</div>		
						  	<div>
								<div style="width:80%;margin:0 auto;">
										<div id="kkpager"></div>
										<input type="hidden" value="${totalPage}" id="totalPage">
										<input type="hidden" value="${totalRecords}" id="totalRecords">
								</div>
								</div>
						    </div>
					    </div>
					</div>
				</div>
		</div>
</div>
</div>


					
<!-- END PAGE CONTAINER -->




		




<!-- 底部开始 -->
<#include "/include/foot.html" />
<!-- 底部结束 -->

<!--[if lt IE 9]>
<script src="${request.getContextPath()}/Public/assets/global/plugins/respond.min.js"></script>
<script src="${request.getContextPath()}/Public/assets/global/plugins/excanvas.min.js"></script> 
<![endif]-->
<script src="${request.getContextPath()}/Public/assets/global/plugins/jquery.min.js" type="text/javascript"></script>
<script src="${request.getContextPath()}/Public/My97DatePicker/WdatePicker.js" type="text/javascript"></script>


<script src="${request.getContextPath()}/Public/assets/global/plugins/jquery-migrate.min.js" type="text/javascript"></script>
<script src="${request.getContextPath()}/Public/assets/global/plugins/jquery-ui/jquery-ui.min.js" type="text/javascript"></script>
<script src="${request.getContextPath()}/Public/assets/global/plugins/bootstrap/js/bootstrap.min.js" type="text/javascript"></script>
<script src="${request.getContextPath()}/Public/assets/global/plugins/bootstrap-hover-dropdown/bootstrap-hover-dropdown.min.js" type="text/javascript"></script>
<script src="${request.getContextPath()}/Public/assets/global/plugins/jquery-slimscroll/jquery.slimscroll.min.js" type="text/javascript"></script>
<script src="${request.getContextPath()}/Public/assets/global/plugins/jquery.blockui.min.js" type="text/javascript"></script>
<script src="${request.getContextPath()}/Public/assets/global/plugins/jquery.cokie.min.js" type="text/javascript"></script>
<script src="${request.getContextPath()}/Public/assets/global/plugins/uniform/jquery.uniform.min.js" type="text/javascript"></script>
<script src="${request.getContextPath()}/Public/assets/global/plugins/jquery-notific8/jquery.notific8.min.js"></script>
<script src="${request.getContextPath()}/Public/assets/global/plugins/bootstrap-datepicker/js/bootstrap-datepicker.js" type="text/javascript"></script>
<script src="${request.getContextPath()}/Public/assets/global/scripts/metronic.js" type="text/javascript"></script>
<script src="${request.getContextPath()}/Public/assets/admin/scripts/layout.js" type="text/javascript"></script>
<script src="${request.getContextPath()}/Public/assets/global/plugins/kkpager.min.js" type="text/javascript"></script>
<script src="${request.getContextPath()}/Public/assets/admin/scripts/commonUtils.js" type="text/javascript"></script>
<script>




	jQuery(document).ready(function() {

			Metronic.init(); // init metronic core componets
			Layout.init(); // init layout
			CommonUtils.checkInit();
			selectColumn();
		});
	function selectColumn() {
		var value = $("#attribute").val();
		if (value == "a.createdAt") {
			$('#content').bind("click", function(){WdatePicker();});
		} else {
			$('#content').unbind("click");
		}
	}
	
	function  removeContacterList(){
		var a=confirm("确定删除这些联系人到回收站？");
		if(a){
		
			var ids=CommonUtils.getCheckedBoxs().join(",");
				if(ids!=null&&ids!=""){
			 		$.ajax({
						url : "${request.getContextPath()}/contacter/contacterRemove.do",
						type : "post",
						async: false,
						data : {ids:ids},
						success : function(result) {
						   if(result.code=="success"){
							   	  alert("删除成功!");
							   	  window.location="${request.getContextPath()}/contacter/contacterList.do";
							}else {
								alert(result.message);
					   		}
						   }
						});  
				}else{
			
					CommonUtils.succModal("系统提示","至少选择一项删除！");
				}
			}
	}

	
	
	//初始化分页插件
	function getParameter(name) { 
		var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)"); 
		var r = window.location.search.substr(1).match(reg); 
		if (r!=null) return unescape(r[2]); return null;
	}
	
	//init
	$(function(){
			var totalPage = $('#totalPage').val();
			var totalRecords = $('#totalRecords').val();
			
			var pageNo = getParameter('pno');
			if(!pageNo){
				pageNo = 1;
			}
		//生成分页
		//有些参数是可选的，比如lang，若不传有默认值
		kkpager.generPageHtml({
			pno : pageNo,
			//总页码
			total : totalPage,
			//总数据条数
			totalRecords : totalRecords,
			
			getLink : function(n){
				return this.hrefFormer + this.hrefLatter + "?pno="+n;
			}	
		});
	});
	

	
	

	
	
	
	  //弹出编辑邮件窗口
	  function editMail(){  
		  
		  if(CommonUtils.getCheckedBoxs().length <= 0){
			  return CommonUtils.succModal("系统提示","请选择联系人！");
		  }
		  
			CommonUtils.editModal("${request.getContextPath()}/contacter/editMail.do",'60%');
			
	  }
	
	
 	 //发送邮件
	  function sendMail(){  
	  		var ids=CommonUtils.getCheckedBoxs().join(",");
	  		var mailTitle=$("#mailTitle").val();
	  		var mailContent=$("#mailContent").val();
			$.ajax({
				url : "${request.getContextPath()}/contacter/tomail.do",
				type : "post",
				dataType:"json",
				async: false,
				data : {ids:ids,mailTitle:mailTitle,mailContent:mailContent},
				success : function(result) {
				   if(result.code=="success"){
				   		  doClose();
					      CommonUtils.succModal("系统提示", "发送成功！");
					}else {
					 	CommonUtils.succModal("警告", result.message);
			   		}
				  }
			}); 
			
	  }
	  	//关闭窗口
		function doClose(){
			$(".editModal").modal('hide');
			$(".editModal").empty(); 
		}
		 //发送短信调用短信接口
	  function editSMM(){  
			var recipientMobilePhone="";
			$("input[name='checkboxes']:checked").each(function (index){
				var mobilePhone= $(this).attr("data_phone");
				
				if(index==0){
					recipientMobilePhone+=mobilePhone;
				}else{
					recipientMobilePhone+=","+mobilePhone;
				}
			})
				
				if(recipientMobilePhone==""){
					return CommonUtils.succModal("系统提示","请选择联系人！");
				}
			CommonUtils.editModal("${request.getContextPath()}/contacter/editSMM.do?recipientMobilePhone="+recipientMobilePhone,'60%');
			
	  }
	


	
</script>


</body>
</html>